//
//  HQMyFavoriteClassifyCell.m
//  tiku
//
//  Created by lvfeijun on 2021/6/3.
//  Copyright © 2021 edu24ol. All rights reserved.
//

#import "HQMyFavoriteClassifyCell.h"
#import "UIView+HQTouchView.h"

@interface HQMyFavoriteClassifyCell ()

@property (nonatomic, weak) IBOutlet UIImageView *statusImgV;
@property (nonatomic, weak) IBOutlet UILabel *titleLb;
@property (nonatomic, weak) IBOutlet UILabel *detailLb;

- (IBAction)lookAct:(id)sender;
@property (nonatomic, weak) IBOutlet UIButton *lookBt;

@property (weak, nonatomic) IBOutlet UIView *leftView;
@property (weak, nonatomic) IBOutlet UIView *rightView;

@end

@implementation HQMyFavoriteClassifyCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    // Initialization code
    
    UIColor *appthemeColor = [UIColor hq_colorWithHexString:KAPPNavBackgroundColor];
    [self.lookBt setTitleColor:appthemeColor forState:UIControlStateNormal];
    
    self.lookBt.layer.cornerRadius = 12;
    self.lookBt.layer.masksToBounds = YES;
    
    self.statusImgV.layer.cornerRadius = self.statusImgV.hq_width/2;
    self.statusImgV.layer.masksToBounds = YES;
    self.statusImgV.layer.borderColor = [UIColor hq_colorWithHexString:KAPPNavBackgroundColor].CGColor;
    [self.leftView hq_addtouchAction:^(id  _Nonnull view) {
        if (self.delegate && [self.delegate respondsToSelector:@selector(expandWithCell: item:)]) {
            [self.delegate expandWithCell:self item:self.item];
        }
    }];
    [self.rightView hq_addtouchAction:^(id  _Nonnull view) {
        if (self.delegate && [self.delegate respondsToSelector:@selector(clickWithCell: item:)]) {
            [self.delegate clickWithCell:self item:self.item];
        }
    }];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setMidType:(HQChapterExerciseCellMidType)midType
{
    _midType = midType;
            
    UIColor *appThemeColor = [UIColor hq_colorWithHexString:KAPPNavBackgroundColor];
    UIColor *backgroundColor = UIColor.clearColor;
    UIImage *midImg = nil;
    CGFloat borderWidth = 0;
    
    switch (midType) {
            
        case HQChapterExerciseCellMidTypePlus: {
            backgroundColor = appThemeColor;
            self.titleLb.textColor = [UIColor hq_colorWithHexString:KFirstLevelChaptersTitleLableColor];
            midImg = [UIImage imageNamed:KChapterMidimagePlus];
        }
            break;
            
        case HQChapterExerciseCellMidTypeSubPlus: {
            midImg = [[UIImage imageNamed:KChapterMidimageSubPlus] hq_FillColor:appThemeColor];
            self.titleLb.textColor = [UIColor hq_colorWithHexString:KChaptersTitleLableColor];
            borderWidth = 1.5;
        }
            break;
            
        case HQChapterExerciseCellMidTypeMinus: {
            backgroundColor = appThemeColor;
            self.titleLb.textColor = [UIColor hq_colorWithHexString:KFirstLevelChaptersTitleLableColor];
            midImg = [UIImage imageNamed:KChapterMidimageMinus];
        }
            break;
            
        case HQChapterExerciseCellMidTypeSubMinus: {
            midImg = [[UIImage imageNamed:KChapterMidimageSubMinus]
                      hq_FillColor:appThemeColor];
            self.titleLb.textColor = [UIColor hq_colorWithHexString:KChaptersTitleLableColor];
            borderWidth = 1.5;
        }
            break;
            
        default:
            break;
    }
    
    self.statusImgV.image = midImg;
    self.statusImgV.backgroundColor = backgroundColor;
    self.statusImgV.layer.borderWidth = borderWidth;
}

- (IBAction)lookAct:(id)sender
{
}
@end
